package com.gjy.spring.b03;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-12-18 16:38:09
 */
@Component
public class Bean1 {

    private static final Logger log = LoggerFactory.getLogger(Bean1.class);

    protected Bean2 bean2;
    protected boolean init;

    @Autowired
    public void setBean2(Bean2 bean2) {
        log.info("setBean2(Bean2 bean2)");
        this.bean2 = bean2;
    }

    @PostConstruct
    public void init() {
        log.info("init()");
        init = true;
    }

    public Bean2 getBean2() {
        log.info("getBean2");
        return bean2;
    }

    public boolean isInit() {
        return init;
    }

    public void setInit(boolean init) {
        this.init = init;
    }

    public void m1() {
        System.out.println("m1");
    }

    final public void m2() {
        System.out.println("m2");
    }

    static public void m3() {
        System.out.println("m3");
    }

    private void m4() {
        System.out.println("m4");
    }
}
